<!DOCTYPE html>
<html lang="en">
<title>${coach.nickName}教练[${year}-${month?string('00')}]补充课时费及扣费</title>
<#import "/layout/layout.html" as body/>
<@body.page>
<link href="${baseUrl}css//plugins/magicsuggest/magicsuggest-min.css" rel="stylesheet">

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title overflow">
                    <h5 class="pull-left">${coach.nickName}教练[${year}-${month?string('00')}]补充课时费及扣费</h5>
                </div>
                <div class="ibox-content">
                    <form id="addForm" class="form-horizontal">
                        <input type="hidden" id="id" name="id" value="${(coachAdjust.id)!}">
                        <input type="hidden" id="coachId" name="coachId" value="${coach.id}">
                        <input type="hidden" id="adjustYear" name="adjustYear" value="${year}">
                        <input type="hidden" id="adjustMonth" name="adjustMonth" value="${month}">

                        <!--补充课时费-->
                        <div class="form-group"><h5 class="col-sm-12 margin-top">补充课时费</h5></div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">补充课时费</label>
                            <div class="col-sm-10">
                                <input type="text" id="coachCourseSupplementFee" name="coachCourseSupplementFee" value="${(coachAdjust.coachCourseSupplementFee)!}" class="form-control" placeholder="请填写本月需添加的补充课时费">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">说明</label>
                            <div class="col-sm-10">
                                <input type="text" id="coachCourseSupplementRemark" name="coachCourseSupplementRemark" value="${(coachAdjust.coachCourseSupplementRemark)!}" class="form-control" placeholder="请填写补充课时费的说明, 如: XX 公司团建费用">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>

                        <!--扣费-->
                        <div class="form-group"><h5 class="col-sm-12 margin-top">扣费</h5></div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">扣费费用</label>
                            <div class="col-sm-10">
                                <input type="text" id="coachCourseReduceFee" name="coachCourseReduceFee" value="${(coachAdjust.coachCourseReduceFee)!}" class="form-control" placeholder="请填写扣费费用">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">檬营结算分隔金额</label>
                            <div class="col-sm-10">
                                <input type="text" id="coachCourseReduceRemark" name="coachCourseReduceRemark" value="${(coachAdjust.coachCourseReduceRemark)!}" c class="form-control" placeholder="请填写本次扣费的说明, 如: XX 课迟到或用户投诉">
                            </div>
                        </div>

                    </form>
                </div>
                <div class="ibox-content overflow">
                    <div class="col-sm-12">
                        <button type="button" onclick="window.history.go(-1);" class="btn btn-default pull-left">取消编辑</button>
                        <button type="button" id="submit" class="btn btn-primary pull-right">确认编辑</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>

    var check = true;
    $(document).ready(function () {

        $("#submit").click(function () {
            check = true;

            if (check) {
                submit();
            }
        });
        /**
         * 保存
         *
         */
        function submit() {
            if (check) {
                var param = $("#addForm").serialize();
                debugger;
                $.post(
                    "save_coach_course_adjust_fee",
                    param,
                    function (result) {
                        debugger;
                        if (result === "true") {
                            swal("保存成功!", "页面即将重新加载,请稍后...", "success");
                            window.setTimeout(function () {
                                window.location = "coachCourseFeeList?coachId=${coach.id}";
                            }, 1000);
                        } else {
                            swal("保存失败!", '', "error");
                        }
                    }
                );
            }

        }
    });
</script>
</@body.page>
</html>